<!--
 * @Author: 订单编号和订单金额
 * @Date: 2020-06-30 09:51:23
 * @LastEditTime: 2020-07-06 15:46:23
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \JK商城\jkshopping\src\pages\payment\order\components\orderpay\components\orderNum.vue
--> 
<template>
  <div class="orderNum">
    <div class="order_box">
      <div class="order_num">
        <span class="name">订单编号：</span>
        <span class="num">1213123114242</span>
      </div>
      <div class="order_total">
        <span class="name">订单金额</span>
        <span class="total">{{ getSum() | toFixed | rmb}}港元</span>
      </div>
    </div>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapState } = createNamespacedHelpers("cartModule");
export default {
  data() {
    return {
      goodsList: []
    };
  },
  computed: {
    //获取勾选的商品
    ...mapState(["isChecked"])
  },
  methods: {
    //计算总价钱
    getSum() {
      var sum = 0;
      for (var i in this.goodsList) {
        sum +=
          this.goodsList[i].price_original * this.goodsList[i].goods_number;
      }
      return sum;
    }
  },

  activated() {
    
     this.goodsList = this.isChecked
  },
};
</script>

<style lang="scss" scoped>
.orderNum {
  /* 装订单编号和订单金额*/
  margin-top: 10px;
  .order_box {
    width: 100%;
    // height: 100px;
    background-color: #fff;
    /*订单编号样式*/
    .order_num {
      height: 50px;
      line-height: 30px;
      border-bottom: 1px solid #ccc;
      padding: 10px;
      box-sizing: border-box;
      color: #ccc;
      font-size: 18px;
      .name {
      }
      .num {
      }
    }
    /*订单金额样式*/
    .order_total {
      height: 50px;
      line-height: 30px;
      padding: 10px;
      box-sizing: border-box;
      font-weight: bold;
      font-size: 18px;
      .name {
        margin-right: 10px;
      }
      .total {
      }
    }
  }
}
</style>